package com.magina.antiPro.util;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.text.DecimalFormat;

public class NumberMathUtil {

    /**
     * 转换成 12.34% 这样的字符串
     */
    public static DecimalFormat decimalFormat = new DecimalFormat("0.00%");

    /**
     *  *100后保留2位小数
     * @param num
     * @return
     */
    public static Float ToFloatMath(Float num){
        return (float)(Math.round(num*10000))/100;
    }


}
